<!-- 搜索表单 -->
<template>
  <ele-card :body-style="{ padding: '0 5px' }">
    <el-form label-width="auto" @keyup.enter="search">
      <el-row :gutter="8">
        <el-col :lg="6" :md="8" :sm="12" :xs="24">
          <el-form-item label="关键字">
            <el-input
              v-model.trim="form.keyword"
              clearable
              placeholder="请输入关键字搜索"
              @clear="search"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="12" :md="8" :sm="24" :xs="24">
          <el-form-item label-width="16px">
            <el-button type="primary" @click="search">
              查询
            </el-button>
            <el-button @click="reset">
              重置
            </el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </ele-card>
</template>

<script setup>
const emit = defineEmits(['search'])

/** 表单数据 */
const { form, resetFields } = utils.useFormData({
  keyword: '',
})

/** 搜索 */
function search() {
  emit('search', form)
}

/**  重置 */
function reset() {
  resetFields()
  search()
}
</script>
